package com.chixing.controller;

import com.chixing.service.impl.SeatStatusService;
import com.chixing.util.Result;
import org.apache.lucene.util.fst.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 座位状态控制器
 * 提供查询座位状态的REST接口
 */
@CrossOrigin
@RestController
@RequestMapping("/seat-status")
public class SeatStatusController {

    @Autowired
    private SeatStatusService seatStatusService;

    /**
     * 查询单个座位状态
     * @param scheduleId 场次ID
     * @param seatCoordinate 座位坐标
     * @return 座位状态信息
     */
    @GetMapping("/{scheduleId}/{seatCoordinate}")
    public Result getSeatStatus(
            @PathVariable Integer scheduleId,
            @PathVariable String seatCoordinate) {
        try {
            Integer status = seatStatusService.getSeatStatus(scheduleId, seatCoordinate);
            return Result.getSuccess(status);
        } catch (Exception e) {
            return Result.error("查询座位状态失败: " + e.getMessage());
        }
    }
}

